// categor ---- 类别

import request from '@/utils/request'

// 封装分类的请求
export const getCategorAPI = () => request.get('/my/article/cates')

// 封装添加的请求
export const addCategoryAPI = data => request.post('/my/article/addcates', data)

// 删除分类的请求
export const delCategoryAPI = id => {
  return request({
    method: 'DELETE',
    url: '/my/article/deletecate',
    params: { id } // 请求参数、查询参数写这个
    // data: {} // 请求体，写这个
  })
  /**
   * request.get(url, 配置对象)
   * request.delete(url, 配置对象)
   *
   * request.post(url, 请求体, 配置对象)
   * request.put(url, 请求体, 配置对象)
   * request.patch(url, 请求体, 配置对象)
   */
  // return request.delete('/my/cate/del', {
  //   params: { id }
  // })
}

// 更新数据的请求
export const updateCategoryAPI = data => {
  return request.put('/my/article/updatecate', data)
}
